// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: leon

#pragma once

#include <map>
#include <memory>
#include <regex>
#include <string>
#include <vector>

#include "coin2/exchange/base/feed/processor.h"
#include "coin2/exchange/base/market/enums.h"

namespace coin2::exchange::gopax::feed_v1 {
namespace impl {
using namespace coin2::exchange::base::symbology;
struct GopaxChannel {
  std::string event_type;
  std::string subscribe_channel;

  static GopaxChannel Parse(const std::string& channel) {
    if (channel == "OrderBookEvent" ||
        channel == "PublicTradeEvent" ||
        channel == "SubscribeToTradingPair") {
      return GopaxChannel{channel, "SubscribeToTradingPair"};
    } else {
      return GopaxChannel{};
    }
  }
};

class GopaxFeedProcessor : public base::feed::FeedParsingProcessor {
 public:
  explicit GopaxFeedProcessor(
    const std::string& system_name,
    const coin2::exchange::di::ConstantInjection& ci,
    const feed::RawParserConfig& config)
    : FeedParsingProcessor(
        system_name,
        MarketExchangeApi{MarketType::Spot, ExchangeType::Gopax, "v1"},
        ci, config,
        "cc/coin2/exchange/gopax/feed_v1/schema.json") {
  }

  void OnTopicRecord(const base::executor::TopicRecordPacket& packet) override;
};

}  // namespace impl
using impl::GopaxFeedProcessor;
}  // namespace coin2::exchange::gopax::feed_v1
